
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse
from utils.response_code import RETCODE

# 自定义判断用户是否登录的扩展类
class LoginRequiredJSONMixin(LoginRequiredMixin):
    def handle_no_permission(self):
        # 直接响应JSON数据
        return JsonResponse({'code':RETCODE.SESSIONERR,'errmsg':"用户未登录"})
